<?php

class GlistModel extends Model{
	
	public $table='glist';
	
	
	
	public function get_all_data($where=null){
		
		return $this->where($where)->all();
	}
	
	public function add_data(){
		
		$data=Q('post.');
		
		$str='';
		foreach ($data['apid'] as $k => $v) {
			$str .= $v . ',';
			$data['apid']=rtrim($str,',');
		}
		
		$data=array(
			'apid'=>$data['apid'],
			'glinventory'=>$data['glinventory'],
			'glno'=>$data['glno'],
			'gid'=>Q('get.gid')
		);
//		p($data);die;
		return $this->add($data);
	}
	
	public function del_data($where=null){
		
		return $this->where($where)->delete();
	}
	
	public function get_one_data($where=null){
		
		return $this->where($where)->find();
	}
	
	
	
	
	
	
}














